<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<script type="text/javascript">
  <c:if test="${payMents.size()==0}">
    toastr.warning("暂无结账数据");
  </c:if>
  $(function(){
      $('#rcptsNum').val('${outpAcctMaster.rcptsNum}');
      $("#refundNum").val('${outpAcctMaster.refundNum}');
      $("#refundAmount").val('${outpAcctMaster.refundAmount}');
      $("#sumAmount").val('${outpAcctMaster.sumAmount}');
      $("#chargesAmount").val('${outpAcctMaster.chargesAmount}');
  })
  function page(n,s){
      $("#pageNo").val(n);
      $("#pageSize").val(s);
      $("#detailsItems").submit();
      return false;
  }
</script>
<div class="col-lg-6" id="chargeMaster">
    <section class="panel" style="height: 100%">
        <div class="panel-body">
            <table class="table table-bordered mg-t datatable">
                <thead>
                <tr>
                    <th>支付方式</th>
                    <th>收款</th>
                    <th>退款</th>
                    <th>实收</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${payMents}" var="payMents">
                    <tr>
                        <td>${fns:getDictLabel(payMents.moneyType, 'PAY_WAY_DICT', defaultValue)}</td>
                        <td>${payMents.charges}</td>
                        <td>${payMents.refundCharges}</td>
                        <c:set var="charges" value="${payMents.charges}"></c:set>
                        <c:set var="refundCharges" value="${payMents.refundCharges}"></c:set>
                        <td><fmt:formatNumber value="${charges-refundCharges}" pattern="0.00"></fmt:formatNumber></td>
                    </tr>
                </c:forEach>
                </tbody>
            </table>
        </div>
    </section>
</div>
<div class="col-lg-6" id="detailChage">
    <form:form hidden="hidden" id="detailsItems"
               onsubmit="return loadDivForm('detailChage','detailsItems','${ctx}/finance/outpRcptMaster/outpAcctMasterIndex');"
               method="post" class="form-inline">
        <input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
        <input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
    </form:form>
    <section class="panel" style="height: 100%">
        <div class="panel-body">
            <table  class="table table-bordered mg-t datatable">
                <thead>
                <tr>
                    <th>会计科目</th>
                    <th>项目名称</th>
                    <th>应收金额</th>
                    <th>实收金额</th>
                </tr>
                </thead>
                <tbody>
                <c:forEach items="${page.list}" var="item">
                    <tr>
                        <td>${fns:getDictLabels(item.subjCode, 'TALLY_SUBJECT_DICT', '')}</td>
                        <td>${item.itemName}</td>
                        <td>${item.costs}</td>
                        <td>${item.charges}</td>
                        <c:set var="totalCosts" value="${item.costs+totalCosts}"></c:set>
                        <c:set var="totalCharges" value="${item.charges+totalCharges}"></c:set>
                    </tr>
                </c:forEach>
                <tr>
                    <td></td>
                    <td style="color: red">合计</td>
                    <td style="color: red">
                       <%-- <c:out value="${totalCosts}"></c:out>--%>
                        <fmt:formatNumber value="${totalCosts}" pattern="0.00"></fmt:formatNumber>
                    </td>
                    <td style="color: red">
                        <fmt:formatNumber value="${totalCharges}" pattern="0.00"></fmt:formatNumber>
                        <%--<c:out value="${totalCharges}"></c:out>--%>
                    </td>
                </tr>
                </tbody>
            </table>
            <div class="pagination">${page}</div>
        </div>
    </section>
</div>